#include "mypushbutton.h"
#include "ui_mypushbutton.h"

#include <qstyle.h>

MyPushButton::MyPushButton(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MyPushButton)
{
    ui->setupUi(this);
    //设置窗口运行位置
    this->setGeometry(300,150,200,50);

    tbar=new QToolBar(this);
    tbar->setGeometry(20,20,200,50);

    //5: 将QStyle类对象进行实例化，主要目的设置风格，图标是系统自带
    QStyle *sty=QApplication::style();
    QIcon ico=sty->standardIcon(QStyle::SP_MessageBoxInformation);


    tbutton=new QToolButton(this);
    tbutton->setIcon(ico);
    tbutton->resize(800,800);
    tbutton->setText("系统提示帮助");

    tbutton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    // 将tbutton添加到tbar里面
    tbar->addWidget(tbutton);
}

MyPushButton::~MyPushButton()
{
    delete ui;
}
